<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>银行</title>
    <link href="res/style.css" rel="stylesheet">
    <script src="http://47.106.66.89:8080/js/vue.min.js"></script>
    <script src="http://47.106.66.89:8080/js/axios.min.js"></script>
    <link  href="http://47.106.66.89:8080/js/ele-2.15.7/theme-chalk/index.css" rel="stylesheet">
    <script src="http://47.106.66.89:8080/js/ele-2.15.7/index.js"></script>
</head>
<body>
<div id="app" class="flex">
    <main>
        <header class="flex">
            <div>
                <h3>源辰银行</h3>
                <small>ycinfo bank</small>
            </div>
            <div id="contact">
                <div>客服电话: 8888</div>
                <div>网址: www.ycinfo.bank.com</div>
            </div>
        </header>
        <div class="msg">
            倒计时: <h2>32</h2> 秒
        </div>
        <div id="pane" class="flex">
            <div class="btns">
                <a href="query.html" class="left">查询</a>
                <a href="transfer.html" class="left">转账</a>
                <a href="setpwd.html" class="left">改密</a>
            </div>
            <div id="info">
                <h2>请选择服务</h2>
            </div>
            <div class="btns">
                <a href="withdraw.html" class="right">取款</a>
                <a href="deposit.html" class="right">存款</a>
                <a href="pay.html" class="right">缴费</a>
                <a href="index.html" class="right" @click.prevent="logout">退出</a>
            </div>
        </div>
    </main>
</div>
<script>
    var v = new Vue({
        el: "#app",
        data: {
            id: "",
            password: "",
        },
        created() {
        },
        methods: {
            logout() {
                // 使用 confirm 弹出确认对话框
                const isConfirmed = window.confirm("是否退出登录？");
                // 检查用户是否点击了确定按钮
                if (isConfirmed) {
                    // 用户确认退出登录，发送 POST 请求到后端的登出接口
                    axios.post("user/logout") // 注意：这里应该是 "user/logout" 而不是 "user/login"
                        .then(res => {
                            this.$message('登出成功！');
                        })
                        .catch(error => {
                            // 处理错误
                            this.$message('登出错误！');
                        });
                } else {
                    // 用户取消退出登录
                    console.log("登出已取消");
                }
            }
        }
    });
</script>
</body>
</html>
